import request from '@/utils/request'
// 新增平台
export function addPlatform(type, formData) {
  return request({
    url: '/platform/add',
    method: 'post',
    data: { type, formData }
  })
}

// 获取平台列表
export function getPlatformList(page, size, search, order, isDel = 0) {
  return request({
    url: '/platform/getPlatformList',
    method: 'post',
    params: { page, size, search, order, isDel }
  })
}

// 停用/开启
export function changePlatformStatus(id) {
  return request({
    url: '/platform/status',
    method: 'post',
    data: { id }
  })
}

export function deletePlatform(id) {
  return request({
    url: '/platform/delete',
    method: 'post',
    data: { id }
  })
}

// 获取详情
export function getPlatform(id) {
  return request(
    {
      url: '/platform/index/' + id,
      method: 'get'
    },
    {
      repeat_request_cancel: false
    }
  )
}

export function editUserForm(id) {
  return request({
    url: '/platform/editUserForm',
    method: 'post',
    data: { id }
  })
}

// 恢复平台
export function recoveryPlatform(id) {
  return request({
    url: '/platform/recovery',
    method: 'post',
    data: { id }
  })
}

// CleanPlatform
export function destroyPlatform(id) {
  return request({
    url: '/platform/destroy',
    method: 'post',
    data: { id }
  })
}
